package com.joe.learn.jvm;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

public class JobETask implements JobTask {

    private static final Logger logger = LoggerFactory.getLogger("My Code");
    private File file;

    public JobETask(File i) {
        this.file = i;
    }


    @Override
    public void run() {
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100; i++) {
            m2(i, file);
        }
        logger.info(" 共花费时间：--->{} ", (System.currentTimeMillis() - start));

    }


    public void m2(int i, File threadNum) {
        JobBean jobBean = new JobBean(i++, "My Code", "第" + threadNum + "个线程", "这是一个测试，需要很长的文字，因此来测试一下。", "测试方法长度偏长，对jvm的性能影响。", new int[1024]);
        jobBean.writeFile(threadNum);

    }


}
